#include "Entity2D.h"
#include "Renderer.h"
using namespace Engine;


Entity2D::Entity2D(){
	_x = 0;
	_y = 0;
	_z = 0;
	_w = 0;
	_h = 0;
	_rot = 0;
	m_name = "New Entity";
}


Entity2D::~Entity2D(){

}



void Entity2D::SetPosition(float x, float y){
	_x = x;
	_y = y;
	_z = 1;
}



void Entity2D::SetScale(float w, float h){
	_w = w;
	_h = h;
}


void Entity2D::SetRotation(float r){
	_rot = r;
}




float Entity2D::GetPositionX(){
	return _x;
}



float Entity2D::GetPositionY(){
	return _y;
}



void Entity2D::GetPositionXY(float& x, float& y){
	x = _x;
	y = _y;
}



float Entity2D::GetScaleX(){
	return _w;
}



float Entity2D::GetScaleY(){
	return _h;
}


void Entity2D::GetScaleXY(float& x, float& y){
	x = _w;
	y = _h;
}


float Entity2D::GetRotation(){
	return _rot;
}


void Entity2D::Draw(Renderer* renderer){
	renderer->SetMatrixMode(World);
	renderer->LoadIdentity();
	renderer->Translate(_x, _y);
	renderer->Scale(_w, _h);
	renderer->SetTexture(NULL);
}


void Entity2D::SetName(std::string name){
	m_name = name;
}


std::string Entity2D::GetName() const{
	return m_name;
}